using System;
using System.Collections.Generic;
using System.Text;
using System.Web;
using System.Configuration;

namespace BO
{
    public class Utils
    {
        public static string BuildNewsUrl(string Category_DisplayUrl, int News_ID, string News_Title)
        {
            return "/" + Category_DisplayUrl + "/" + News_ID + "/" + UnicodeUtility.UnicodeToKoDauAndGach(News_Title) + PublicConstants.CUSTOM_EXTENSION;
        }
        public static string BuidImageUrl(string Image_Url)
        {
            return ConfigurationManager.AppSettings["imagehost"] + Image_Url;
        }
        public class QueryString
        {
            public static string GetReturnUrl()
            {
                if (String.IsNullOrEmpty(HttpContext.Current.Request.QueryString["return"]))
                {
                    return String.Empty;
                }
                else return HttpContext.Current.Request.QueryString["return"];
            }
            public static int GetNewsID()
            {
                int result = 0;
                try
                {
                    result = Convert.ToInt32(HttpContext.Current.Request.QueryString["newsid"]);
                }
                catch { }
                return result;
            }
            public static int GetCategoryID()
            {
                int result = 0;
                try
                {
                    result = Convert.ToInt32(HttpContext.Current.Request.QueryString["categoryid"]);
                }
                catch { }
                return result;
            }
            public static int GetPage()
            {
                int result = 0;
                try
                {
                    result = Convert.ToInt32(HttpContext.Current.Request.QueryString["page"]);
                }
                catch { }
                return result;
            }
        }
    }
}
